//
//  LKUserLoginViewModel.m
//  YLHelper
//
//  Created by she1323 on 2018/4/11.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKUserLoginViewModel.h"

@interface LKUserLoginViewModel()



@end


@implementation LKUserLoginViewModel

-(instancetype)init{
    if (self = [super init]) {
        [self setUp];
    }
    return self;
}
-(void)setUp{
    _enableLoginSignal = [RACSignal combineLatest:@[RACObserve(self, userName),RACObserve(self, passWord)] reduce:^id _Nullable(NSString *username,NSString *password){
        return @(username.length && password.length && ![username  isEqual: @""] && ![password  isEqual: @""]);
    }];

}

-(RACCommand *)logincommand{
    if (!_logincommand) {
        _logincommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
            return [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber>  _Nonnull subscriber) {
                NSLog(@"这是你先");
                [subscriber sendNext:@"sh"];
                return nil;
            }];
        }];
    }
    return _logincommand;
}

@end
